<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
// load base class if needed
require_once( APPPATH . 'controllers/base/OperatorBase.php' );

class asettetap extends ApplicationBase {
    private $kat_elektronik = 1;
    private $kat_mebel = 2;
    private $kat_multimedia = 3;
    private $kat_tanah = 4;
    private $kat_bangunan = 5;
    private $kat_kendaraan = 6;
    private $kat_mesin = 7;

    // constructor
    public function __construct() {
        parent::__construct();
        // load model  
        $this->load->model('m_report_asset');
        // load library
        $this->load->library('tnotification');
        $this->load->library('pagination'); 
        $this->load->library('phpexcel');
        
        // load helpers 
        $this->smarty->load_javascript("resource/js/jquery.datatable/FixedColumns.js");
        $this->smarty->load_javascript("resource/js/jquery.datatable/jquery.dataTables.js");
        $this->smarty->load_javascript("resource/js/fusioncharts/fusioncharts.js");
    }

    // welcome administrator
    public function index() {
        $this->_set_page_rule("R");

        // set template content
        $this->smarty->assign("template_content", "laporan/asettetap/overview.html");
        // get data
        $this->smarty->assign("rs_mebel", $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_mebel,"","baik")));
        $this->smarty->assign("rs_perlengkapan", $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_elektronik,$this->kat_multimedia,"baik")));
        $this->smarty->assign("rs_kendaraan", $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_kendaraan,"","baik")));
        $this->smarty->assign("rs_bangunan", $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_bangunan,"","baik")));
        $this->smarty->assign("rs_mesin", $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_mesin,"","baik")));
        $this->smarty->assign("rs_tanah", $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_tanah,"","")));
        $this->smarty->assign("rs_today", $this->datetimemanipulation->get_date_indonesia(date("Y-m-d")));
        // notification
        $this->tnotification->display_notification();
        $this->tnotification->display_last_field();

        // output
        parent::display();
    } 
    
    /*
     * MEBELAIR & FURNITUR
     */
    
    // welcome administrator
    public function mebelair() {
        $this->_set_page_rule("R");

        // set template content
        $this->smarty->assign("template_content", "laporan/asettetap/mebelair/index.html");
        // get data
        $this->smarty->assign("rs_mebel_gol1", $this->m_report_asset->get_mebelair(array(date("Y-m-d"),"4",$this->kat_mebel)));
        $this->smarty->assign("rs_mebel_gol2", $this->m_report_asset->get_mebelair(array(date("Y-m-d"),"2",$this->kat_mebel)));
        $this->smarty->assign("year", date("Y"));
        $this->smarty->assign("last_year", date("Y", strtotime("-1 year")));
        // notification
        $this->tnotification->display_notification();
        $this->tnotification->display_last_field();

        // output
        parent::display();
    } 
    
    public function print_mebelair(){
        // set page rules
        $this->_set_page_rule("R");
        // style title header
        $styleTitleHeader = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => 'bold',
                'size' => 11
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER
            )
        );

        // style text
        $styleText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 10
            )
        );
        
        $styleMediumText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 11
            )
        );
        
        $styleBigText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 14
            )
        );

        // style desc title column
        $styleDescColumn = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => true,
                'size' => 10
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                ),
            )
        );

        // style content
        $styleContent = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => false,
                'size' => 10
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style border
        $styleBorder = array(
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style bold
        $styleBold = array(
            'font' => array(
                'bold' => true
            )
        );

        // style right alignment
        $styleRightAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style left alignment
        $styleLeftAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleLeftAlignment2 = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_TOP
            ),
        );

        // style justify alignment
        $styleJustifyAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style center alignment
        $styleCenterAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleBorderBottom = array(
            'borders' => array(
                'bottom' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );
        
        $styleBorderRight = array(
            'borders' => array(
                'right' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // data
        $rs_mebel_gol1 = $this->m_report_asset->get_mebelair(array(date("Y-m-d"),"4",$this->kat_mebel));
        $rs_mebel_gol2 = $this->m_report_asset->get_mebelair(array(date("Y-m-d"),"2",$this->kat_mebel));
        $year = date("Y");
        $last_year = date("Y", strtotime("-1 year"));
        
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('C')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('D')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('E')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('F')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('G')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('I')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('K')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('M')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('N')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('O')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)
                ->setCellValue('A1', "STMIK AMIKOM YOGYAKARTA")
                ->setCellValue('A2', "ASET TETAP DAN AKUMULASI PENYUSUTAN")
                ->setCellValue('A3', "MEBELAIR & FURNITUR")
                ->setCellValue('A4', "Metode penyusutan : Garis lurus")
                ->setCellValue('A5', "Mebelair & Furnitur (Gol 1)")
                ->setCellValue('A6', "Mebelair & Furnitur (Gol 2)")
                ->setCellValue('D5', "4 Tahun")
                ->setCellValue('D6', "2 Tahun")
                ->setCellValue('E5', "Perkantoran")
                ->setCellValue('E6', "Perkuliahan")
                ->setCellValue('A8', 'No')
                ->setCellValue('B8', 'Keterangan')
                ->setCellValue('C8', 'No Inventaris')
                ->setCellValue('D8', 'Tanggal Perolehan')
                ->setCellValue('E8', 'Tanggal Berakhir')
                ->setCellValue('F8', 'Gol')
                ->setCellValue('G8', 'Umur Manfaat (bulan)')
                ->setCellValue('H8', 'Harga Perolehan Baru')
                ->setCellValue('I8', 'Tarif (%)')
                ->setCellValue('J8', 'Tarif penyusutan per bulan')
                ->setCellValue('K8', 'Waktu penggunaan (bulan)')
                ->setCellValue('L8', 'Akm. Peny. 31-Des-'.$last_year)
                ->setCellValue('M8', 'Penyusutan Thn '.$year)
                ->setCellValue('N8', 'Akm. Peny. 31-Des-'.$year)
                ->setCellValue('O8', 'Nilai Buku 31-Des-'.$last_year);
        $this->phpexcel->getActiveSheet()
                ->mergeCells('A1:O1')
                ->mergeCells('A2:O2')
                ->mergeCells('A3:O3')
                ->mergeCells('A4:O4')
                ->mergeCells('A5:C5')
                ->mergeCells('A6:C6')
                ->mergeCells('E5:O5')
                ->mergeCells('E6:O6');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O6')->applyFromArray($styleTitleHeader);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O6')->applyFromArray($styleLeftAlignment);
//        $this->phpexcel->getActiveSheet()->getRowDimension(4)->setRowHeight(40.00);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A8:O8')->applyFromArray($styleDescColumn);
        // set width
        $this->phpexcel->getActiveSheet()->getColumnDimension('A')->setWidth(4.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('B')->setWidth(30.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('C')->setWidth(20.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('D')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('E')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('F')->setWidth(5.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('G')->setWidth(9.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('H')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('I')->setWidth(10.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('J')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('K')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('L')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('M')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('N')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('O')->setWidth(15.00);
        //set data gol 1
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B9', "Mebelair & Furnitur (Gol 1)");
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A9:O9')->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A9:O9')->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B9')->applyFromArray($styleBold);
        $row = 10;
        $nom = 1;
        $hp_gol1 = 0;
        $aly_gol1 = 0;
        $pt_gol1 = 0;
        $ay_gol1 = 0;
        $nb_gol1 = 0;
        foreach ($rs_mebel_gol1 as $val) {
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('A' . $row, $nom++);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, $val['barang_nama']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('C' . $row, $val['barang_noinventaris']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('D' . $row, $this->datetimemanipulation->get_short_date_indo($val['barang_tglbeli']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('E' . $row, $this->datetimemanipulation->get_short_date_indo($val['tgl_berakhir']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('F' . $row, "1");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('G' . $row, $val['umur_manfaat']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H' . $row, $val['barang_harga_beli'])->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('I' . $row, $val['tarif']."%");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('J' . $row, $val['tarif_penyusutan'])->getStyle("J" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('K' . $row, $val['waktu']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L' . $row, $val['akm_last_year'])->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M' . $row, $val['penyusutan_thn'])->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N' . $row, ($val['akm_last_year'] - $val['penyusutan_thn']))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O' . $row, $val['barang_nilai_buku'])->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
            //hitung
            $hp_gol1 = $hp_gol1 + $val['barang_harga_beli'];
            $aly_gol1 = $aly_gol1 + $val['akm_last_year'];
            $pt_gol1 = $pt_gol1 + $val['penyusutan_thn'];
            $ay_gol1 = $ay_gol1 + ($val['akm_last_year'] - $val['penyusutan_thn']);
            $nb_gol1 = $nb_gol1 + $val['barang_nilai_buku'];
            //style
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleCenterAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleText);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleBorder);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
            $row++;
        }
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Mebelair & Furnitur (Gol 1)");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, $hp_gol1)->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, $aly_gol1)->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, $pt_gol1)->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, $ay_gol1)->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, $nb_gol1)->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        $row++;
        //set data gol 2
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, "Mebelair & Furnitur (Gol 2)");
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row.':O' . $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row.':O' . $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleBold);
        $row++;
        $nmr = 1;
        $hp_gol2 = 0;
        $aly_gol2 = 0;
        $pt_gol2 = 0;
        $ay_gol2 = 0;
        $nb_gol2 = 0;
        foreach ($rs_mebel_gol2 as $val) {
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('A' . $row, $nmr++);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, $val['barang_nama']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('C' . $row, $val['barang_noinventaris']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('D' . $row, $this->datetimemanipulation->get_short_date_indo($val['barang_tglbeli']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('E' . $row, $this->datetimemanipulation->get_short_date_indo($val['tgl_berakhir']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('F' . $row, "1");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('G' . $row, $val['umur_manfaat']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H' . $row, $val['barang_harga_beli'])->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('I' . $row, $val['tarif']."%");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('J' . $row, $val['tarif_penyusutan'])->getStyle("J" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('K' . $row, $val['waktu']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L' . $row, $val['akm_last_year'])->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M' . $row, $val['penyusutan_thn'])->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N' . $row, ($val['akm_last_year'] - $val['penyusutan_thn']))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O' . $row, $val['barang_nilai_buku'])->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
            //hitung
            $hp_gol2 = $hp_gol2 + $val['barang_harga_beli'];
            $aly_gol2 = $aly_gol2 + $val['akm_last_year'];
            $pt_gol2 = $pt_gol2 + $val['penyusutan_thn'];
            $ay_gol2 = $ay_gol2 + ($val['akm_last_year'] - $val['penyusutan_thn']);
            $nb_gol2 = $nb_gol2 + $val['barang_nilai_buku'];
            //style
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleCenterAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleText);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleBorder);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
            $row++;
        }
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Mebelair & Furnitur (Gol 2)");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, $hp_gol2)->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, $aly_gol2)->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, $pt_gol2)->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, $ay_gol2)->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, $nb_gol2)->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        $row++;
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Aset Mebelair & Furnitur");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, ($hp_gol1 + $hp_gol2))->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, ($aly_gol1 + $aly_gol2))->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, ($pt_gol1 + $pt_gol2))->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, ($ay_gol1 + $ay_gol2))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, ($nb_gol1 + $nb_gol2))->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        // setting
        $this->phpexcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
        $this->phpexcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
        $this->phpexcel->getActiveSheet()->setTitle('Mebelair & Furnitur');
        $this->phpexcel->setActiveSheetIndex(0);
        //--
        $file_name = 'ASET_TETAP_MEBELAIR_FURNITUR_'.date("d").'_'.date("m").'_'.date("Y");
        //--
//            header('Content-Type: application/vnd.ms-excel');
        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        header('Content-Disposition: attachment;filename=' . $file_name . '.xlsx');
        header('Cache-Control: max-age=0');
        // output
        $obj_writer = PHPExcel_IOFactory::createWriter($this->phpexcel, 'Excel2007');
        $obj_writer->save('php://output');
    }
    
    /*
     * MESIN & TOWER
     */
    
    // welcome administrator
    public function mesin() {
        $this->_set_page_rule("R");

        // set template content
        $this->smarty->assign("template_content", "laporan/asettetap/mesin/index.html");
        // get data
        $this->smarty->assign("rs_mesin", $this->m_report_asset->get_mesin(array(date("Y-m-d"),"4",$this->kat_mesin)));
        $this->smarty->assign("year", date("Y"));
        $this->smarty->assign("last_year", date("Y", strtotime("-1 year")));
        // notification
        $this->tnotification->display_notification();
        $this->tnotification->display_last_field();

        // output
        parent::display();
    } 
    
    public function print_mesin(){
        // set page rules
        $this->_set_page_rule("R");
        // style title header
        $styleTitleHeader = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => 'bold',
                'size' => 11
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER
            )
        );

        // style text
        $styleText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 10
            )
        );
        
        $styleMediumText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 11
            )
        );
        
        $styleBigText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 14
            )
        );

        // style desc title column
        $styleDescColumn = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => true,
                'size' => 10
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                ),
            )
        );

        // style content
        $styleContent = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => false,
                'size' => 10
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style border
        $styleBorder = array(
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style bold
        $styleBold = array(
            'font' => array(
                'bold' => true
            )
        );

        // style right alignment
        $styleRightAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style left alignment
        $styleLeftAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleLeftAlignment2 = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_TOP
            ),
        );

        // style justify alignment
        $styleJustifyAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style center alignment
        $styleCenterAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleBorderBottom = array(
            'borders' => array(
                'bottom' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );
        
        $styleBorderRight = array(
            'borders' => array(
                'right' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // data
        $rs_mesin = $this->m_report_asset->get_mesin(array(date("Y-m-d"),"4",$this->kat_mesin));
        $year = date("Y");
        $last_year = date("Y", strtotime("-1 year"));
        
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('C')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('D')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('E')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('F')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('G')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('I')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('K')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('M')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('N')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('O')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)
                ->setCellValue('A1', "STMIK AMIKOM YOGYAKARTA")
                ->setCellValue('A2', "ASET TETAP DAN AKUMULASI PENYUSUTAN")
                ->setCellValue('A3', "MESIN & TOWER")
                ->setCellValue('A4', "Metode penyusutan : Garis lurus")
                ->setCellValue('A5', "Mesin dan Tower")
                ->setCellValue('D5', "8 Tahun")
                ->setCellValue('A8', 'No')
                ->setCellValue('B8', 'Keterangan')
                ->setCellValue('C8', 'No Inventaris')
                ->setCellValue('D8', 'Tanggal Perolehan')
                ->setCellValue('E8', 'Tanggal Berakhir')
                ->setCellValue('F8', 'Gol')
                ->setCellValue('G8', 'Umur Manfaat (bulan)')
                ->setCellValue('H8', 'Harga Perolehan Baru')
                ->setCellValue('I8', 'Tarif (%)')
                ->setCellValue('J8', 'Tarif penyusutan per bulan')
                ->setCellValue('K8', 'Waktu penggunaan (bulan)')
                ->setCellValue('L8', 'Akm. Peny. 31-Des-'.$last_year)
                ->setCellValue('M8', 'Penyusutan Thn '.$year)
                ->setCellValue('N8', 'Akm. Peny. 31-Des-'.$year)
                ->setCellValue('O8', 'Nilai Buku 31-Des-'.$last_year);
        $this->phpexcel->getActiveSheet()
                ->mergeCells('A1:O1')
                ->mergeCells('A2:O2')
                ->mergeCells('A3:O3')
                ->mergeCells('A4:O4')
                ->mergeCells('A5:C5')
                ->mergeCells('D5:O5');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O5')->applyFromArray($styleTitleHeader);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O5')->applyFromArray($styleLeftAlignment);
//        $this->phpexcel->getActiveSheet()->getRowDimension(4)->setRowHeight(40.00);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A8:O8')->applyFromArray($styleDescColumn);
        // set width
        $this->phpexcel->getActiveSheet()->getColumnDimension('A')->setWidth(4.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('B')->setWidth(30.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('C')->setWidth(20.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('D')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('E')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('F')->setWidth(5.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('G')->setWidth(9.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('H')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('I')->setWidth(10.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('J')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('K')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('L')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('M')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('N')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('O')->setWidth(15.00);
        //set data gol 1
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B9', "Mesin dan Tower");
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A9:O9')->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A9:O9')->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B9')->applyFromArray($styleBold);
        $row = 10;
        $nom = 1;
        $hp = 0;
        $aly = 0;
        $pt = 0;
        $ay = 0;
        $nb = 0;
        foreach ($rs_mesin as $val) {
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('A' . $row, $nom++);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, $val['barang_nama']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('C' . $row, $val['barang_noinventaris']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('D' . $row, $this->datetimemanipulation->get_short_date_indo($val['barang_tglbeli']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('E' . $row, $this->datetimemanipulation->get_short_date_indo($val['tgl_berakhir']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('G' . $row, $val['umur_manfaat']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H' . $row, $val['barang_harga_beli'])->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('I' . $row, $val['tarif']."%");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('J' . $row, $val['tarif_penyusutan'])->getStyle("J" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('K' . $row, $val['waktu']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L' . $row, $val['akm_last_year'])->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M' . $row, $val['penyusutan_thn'])->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N' . $row, ($val['akm_last_year'] - $val['penyusutan_thn']))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O' . $row, $val['barang_nilai_buku'])->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
            //hitung
            $hp = $hp + $val['barang_harga_beli'];
            $aly = $aly + $val['akm_last_year'];
            $pt = $pt + $val['penyusutan_thn'];
            $ay = $ay + ($val['akm_last_year'] - $val['penyusutan_thn']);
            $nb = $nb + $val['barang_nilai_buku'];
            //style
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleCenterAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleText);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleBorder);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
            $row++;
        }
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Aset Mesin dan Tower");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, $hp)->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, $aly)->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, $pt)->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, $ay)->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, $nb)->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        
        // setting
        $this->phpexcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
        $this->phpexcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
        $this->phpexcel->getActiveSheet()->setTitle('Mesin & Tower');
        $this->phpexcel->setActiveSheetIndex(0);
        //--
        $file_name = 'ASET_TETAP_MESIN_TOWER_'.date("d").'_'.date("m").'_'.date("Y");
        //--
//            header('Content-Type: application/vnd.ms-excel');
        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        header('Content-Disposition: attachment;filename=' . $file_name . '.xlsx');
        header('Cache-Control: max-age=0');
        // output
        $obj_writer = PHPExcel_IOFactory::createWriter($this->phpexcel, 'Excel2007');
        $obj_writer->save('php://output');
    }
    
    /*
     * PERLENGKAPAN KANTOR & PERKULIAHAN
     */
    
    // welcome administrator
    public function perlengkapan() {
        $this->_set_page_rule("R");

        // set template content
        $this->smarty->assign("template_content", "laporan/asettetap/perlengkapan/index.html");
        // get data
        $this->smarty->assign("rs_perlengkapan_gol1", $this->m_report_asset->get_perlengkapan(array(date("Y-m-d"),"4",$this->kat_elektronik,$this->kat_multimedia)));
        $this->smarty->assign("rs_perlengkapan_gol2", $this->m_report_asset->get_perlengkapan(array(date("Y-m-d"),"2",$this->kat_elektronik,$this->kat_multimedia)));
        $this->smarty->assign("year", date("Y"));
        $this->smarty->assign("last_year", date("Y", strtotime("-1 year")));
        // notification
        $this->tnotification->display_notification();
        $this->tnotification->display_last_field();

        // output
        parent::display();
    } 
    
    public function print_perlengkapan(){
        // set page rules
        $this->_set_page_rule("R");
        // style title header
        $styleTitleHeader = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => 'bold',
                'size' => 11
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER
            )
        );

        // style text
        $styleText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 10
            )
        );
        
        $styleMediumText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 11
            )
        );
        
        $styleBigText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 14
            )
        );

        // style desc title column
        $styleDescColumn = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => true,
                'size' => 10
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                ),
            )
        );

        // style content
        $styleContent = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => false,
                'size' => 10
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style border
        $styleBorder = array(
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style bold
        $styleBold = array(
            'font' => array(
                'bold' => true
            )
        );

        // style right alignment
        $styleRightAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style left alignment
        $styleLeftAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleLeftAlignment2 = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_TOP
            ),
        );

        // style justify alignment
        $styleJustifyAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style center alignment
        $styleCenterAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleBorderBottom = array(
            'borders' => array(
                'bottom' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );
        
        $styleBorderRight = array(
            'borders' => array(
                'right' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // data
        $rs_perlengkapan_gol1 = $this->m_report_asset->get_perlengkapan(array(date("Y-m-d"),"4",$this->kat_elektronik,$this->kat_multimedia));
        $rs_perlengkapan_gol2 = $this->m_report_asset->get_perlengkapan(array(date("Y-m-d"),"2",$this->kat_elektronik,$this->kat_multimedia));
        $year = date("Y");
        $last_year = date("Y", strtotime("-1 year"));
        
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('C')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('D')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('E')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('F')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('G')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('I')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('K')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('M')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('N')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('O')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)
                ->setCellValue('A1', "STMIK AMIKOM YOGYAKARTA")
                ->setCellValue('A2', "ASET TETAP DAN AKUMULASI PENYUSUTAN")
                ->setCellValue('A3', "PERLENGKAPAN KANTOR & PERKULIAHAN")
                ->setCellValue('A4', "Metode penyusutan : Garis lurus")
                ->setCellValue('A5', "Perlengkapan kantor dan kelas (Gol 1)")
                ->setCellValue('A6', "Perlengkapan kantor dan kelas (Gol 2)")
                ->setCellValue('D5', "4 Tahun")
                ->setCellValue('D6', "2 Tahun")
                ->setCellValue('A8', 'No')
                ->setCellValue('B8', 'Keterangan')
                ->setCellValue('C8', 'No Inventaris')
                ->setCellValue('D8', 'Tanggal Perolehan')
                ->setCellValue('E8', 'Tanggal Berakhir')
                ->setCellValue('F8', 'Gol')
                ->setCellValue('G8', 'Umur Manfaat (bulan)')
                ->setCellValue('H8', 'Harga Perolehan Baru')
                ->setCellValue('I8', 'Tarif (%)')
                ->setCellValue('J8', 'Tarif penyusutan per bulan')
                ->setCellValue('K8', 'Waktu penggunaan (bulan)')
                ->setCellValue('L8', 'Akm. Peny. 31-Des-'.$last_year)
                ->setCellValue('M8', 'Penyusutan Thn '.$year)
                ->setCellValue('N8', 'Akm. Peny. 31-Des-'.$year)
                ->setCellValue('O8', 'Nilai Buku 31-Des-'.$last_year);
        $this->phpexcel->getActiveSheet()
                ->mergeCells('A1:O1')
                ->mergeCells('A2:O2')
                ->mergeCells('A3:O3')
                ->mergeCells('A4:O4')
                ->mergeCells('A5:C5')
                ->mergeCells('A6:C6')
                ->mergeCells('D5:O5')
                ->mergeCells('D6:O6');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O6')->applyFromArray($styleTitleHeader);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O6')->applyFromArray($styleLeftAlignment);
//        $this->phpexcel->getActiveSheet()->getRowDimension(4)->setRowHeight(40.00);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A8:O8')->applyFromArray($styleDescColumn);
        // set width
        $this->phpexcel->getActiveSheet()->getColumnDimension('A')->setWidth(4.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('B')->setWidth(40.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('C')->setWidth(20.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('D')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('E')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('F')->setWidth(5.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('G')->setWidth(9.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('H')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('I')->setWidth(10.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('J')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('K')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('L')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('M')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('N')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('O')->setWidth(15.00);
        //set data gol 1
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B9', "Perlengkapan Kantor dan Kelas (Gol 1)");
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A9:O9')->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A9:O9')->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B9')->applyFromArray($styleBold);
        $row = 10;
        $nom = 1;
        $hp_gol1 = 0;
        $aly_gol1 = 0;
        $pt_gol1 = 0;
        $ay_gol1 = 0;
        $nb_gol1 = 0;
        foreach ($rs_perlengkapan_gol1 as $val) {
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('A' . $row, $nom++);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, $val['barang_nama']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('C' . $row, $val['barang_noinventaris']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('D' . $row, $this->datetimemanipulation->get_short_date_indo($val['barang_tglbeli']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('E' . $row, $this->datetimemanipulation->get_short_date_indo($val['tgl_berakhir']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('F' . $row, "1");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('G' . $row, $val['umur_manfaat']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H' . $row, $val['barang_harga_beli'])->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('I' . $row, $val['tarif']."%");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('J' . $row, $val['tarif_penyusutan'])->getStyle("J" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('K' . $row, $val['waktu']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L' . $row, $val['akm_last_year'])->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M' . $row, $val['penyusutan_thn'])->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N' . $row, ($val['akm_last_year'] - $val['penyusutan_thn']))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O' . $row, $val['barang_nilai_buku'])->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
            //hitung
            $hp_gol1 = $hp_gol1 + $val['barang_harga_beli'];
            $aly_gol1 = $aly_gol1 + $val['akm_last_year'];
            $pt_gol1 = $pt_gol1 + $val['penyusutan_thn'];
            $ay_gol1 = $ay_gol1 + ($val['akm_last_year'] - $val['penyusutan_thn']);
            $nb_gol1 = $nb_gol1 + $val['barang_nilai_buku'];
            //style
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleCenterAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleText);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleBorder);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
            $row++;
        }
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Perlengkapan Kantor dan Kelas (Gol 1)");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, $hp_gol1)->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, $aly_gol1)->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, $pt_gol1)->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, $ay_gol1)->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, $nb_gol1)->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        $row++;
        //set data gol 2
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, "Perlengkapan Kantor dan Kelas (Gol 2)");
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row.':O' . $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row.':O' . $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleBold);
        $row++;
        $nmr = 1;
        $hp_gol2 = 0;
        $aly_gol2 = 0;
        $pt_gol2 = 0;
        $ay_gol2 = 0;
        $nb_gol2 = 0;
        foreach ($rs_perlengkapan_gol2 as $val) {
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('A' . $row, $nmr++);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, $val['barang_nama']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('C' . $row, $val['barang_noinventaris']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('D' . $row, $this->datetimemanipulation->get_short_date_indo($val['barang_tglbeli']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('E' . $row, $this->datetimemanipulation->get_short_date_indo($val['tgl_berakhir']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('F' . $row, "1");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('G' . $row, $val['umur_manfaat']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H' . $row, $val['barang_harga_beli'])->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('I' . $row, $val['tarif']."%");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('J' . $row, $val['tarif_penyusutan'])->getStyle("J" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('K' . $row, $val['waktu']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L' . $row, $val['akm_last_year'])->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M' . $row, $val['penyusutan_thn'])->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N' . $row, ($val['akm_last_year'] - $val['penyusutan_thn']))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O' . $row, $val['barang_nilai_buku'])->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
            //hitung
            $hp_gol2 = $hp_gol2 + $val['barang_harga_beli'];
            $aly_gol2 = $aly_gol2 + $val['akm_last_year'];
            $pt_gol2 = $pt_gol2 + $val['penyusutan_thn'];
            $ay_gol2 = $ay_gol2 + ($val['akm_last_year'] - $val['penyusutan_thn']);
            $nb_gol2 = $nb_gol2 + $val['barang_nilai_buku'];
            //style
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleCenterAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleText);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleBorder);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
            $row++;
        }
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Perlengkapan Kantor dan Kelas (Gol 2)");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, $hp_gol2)->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, $aly_gol2)->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, $pt_gol2)->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, $ay_gol2)->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, $nb_gol2)->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        $row++;
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Aset Perlengkapan Kantor dan Kelas");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, ($hp_gol1 + $hp_gol2))->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, ($aly_gol1 + $aly_gol2))->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, ($pt_gol1 + $pt_gol2))->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, ($ay_gol1 + $ay_gol2))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, ($nb_gol1 + $nb_gol2))->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        // setting
        $this->phpexcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
        $this->phpexcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
        $this->phpexcel->getActiveSheet()->setTitle('Perlengkapan Kantor dan Kelas');
        $this->phpexcel->setActiveSheetIndex(0);
        //--
        $file_name = 'ASET_TETAP_PERLENGKAPAN_KANTOR_KELAS_'.date("d").'_'.date("m").'_'.date("Y");
        //--
//            header('Content-Type: application/vnd.ms-excel');
        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        header('Content-Disposition: attachment;filename=' . $file_name . '.xlsx');
        header('Cache-Control: max-age=0');
        // output
        $obj_writer = PHPExcel_IOFactory::createWriter($this->phpexcel, 'Excel2007');
        $obj_writer->save('php://output');
    }
    
    /*
     * KENDARAAN
     */
    
    // welcome administrator
    public function kendaraan() {
        $this->_set_page_rule("R");

        // set template content
        $this->smarty->assign("template_content", "laporan/asettetap/kendaraan/index.html");
        // get data
        $this->smarty->assign("rs_kendaraan_gol1", $this->m_report_asset->get_kendaraan(array(date("Y-m-d"),"8",$this->kat_kendaraan)));
        $this->smarty->assign("rs_kendaraan_gol2", $this->m_report_asset->get_kendaraan(array(date("Y-m-d"),"4",$this->kat_kendaraan)));
        $this->smarty->assign("year", date("Y"));
        $this->smarty->assign("last_year", date("Y", strtotime("-1 year")));
        // notification
        $this->tnotification->display_notification();
        $this->tnotification->display_last_field();

        // output
        parent::display();
    } 
    
    public function print_kendaraan(){
        // set page rules
        $this->_set_page_rule("R");
        // style title header
        $styleTitleHeader = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => 'bold',
                'size' => 11
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER
            )
        );

        // style text
        $styleText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 10
            )
        );
        
        $styleMediumText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 11
            )
        );
        
        $styleBigText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 14
            )
        );

        // style desc title column
        $styleDescColumn = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => true,
                'size' => 10
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                ),
            )
        );

        // style content
        $styleContent = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => false,
                'size' => 10
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style border
        $styleBorder = array(
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style bold
        $styleBold = array(
            'font' => array(
                'bold' => true
            )
        );

        // style right alignment
        $styleRightAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style left alignment
        $styleLeftAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleLeftAlignment2 = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_TOP
            ),
        );

        // style justify alignment
        $styleJustifyAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style center alignment
        $styleCenterAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleBorderBottom = array(
            'borders' => array(
                'bottom' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );
        
        $styleBorderRight = array(
            'borders' => array(
                'right' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // data
        $rs_kendaraan_gol1 = $this->m_report_asset->get_kendaraan(array(date("Y-m-d"),"8",$this->kat_kendaraan));
        $rs_kendaraan_gol2 = $this->m_report_asset->get_kendaraan(array(date("Y-m-d"),"4",$this->kat_kendaraan));
        $year = date("Y");
        $last_year = date("Y", strtotime("-1 year"));
        
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('C')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('D')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('E')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('F')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('G')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('I')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('K')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('M')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('N')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('O')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)
                ->setCellValue('A1', "STMIK AMIKOM YOGYAKARTA")
                ->setCellValue('A2', "ASET TETAP DAN AKUMULASI PENYUSUTAN")
                ->setCellValue('A3', "KENDARAAN")
                ->setCellValue('A4', "Metode penyusutan : Garis lurus")
                ->setCellValue('A5', "Kendaraan Roda 4 (Gol 1)")
                ->setCellValue('A6', "Kendaraan Roda 2 (Gol 2)")
                ->setCellValue('D5', "8 Tahun")
                ->setCellValue('D6', "4 Tahun")
                ->setCellValue('A7', "Yang termasuk harga perolehan kendaraan adalah nominal pembelian ditambah pajak dan bea balik nama")
                ->setCellValue('A9', 'No')
                ->setCellValue('B9', 'Keterangan')
                ->setCellValue('C9', 'No Inventaris')
                ->setCellValue('D9', 'Tanggal Perolehan')
                ->setCellValue('E9', 'Tanggal Berakhir')
                ->setCellValue('F9', 'Gol')
                ->setCellValue('G9', 'Umur Manfaat (bulan)')
                ->setCellValue('H9', 'Harga Perolehan Baru')
                ->setCellValue('I9', 'Tarif (%)')
                ->setCellValue('J9', 'Tarif penyusutan per bulan')
                ->setCellValue('K9', 'Waktu penggunaan (bulan)')
                ->setCellValue('L9', 'Akm. Peny. 31-Des-'.$last_year)
                ->setCellValue('M9', 'Penyusutan Thn '.$year)
                ->setCellValue('N9', 'Akm. Peny. 31-Des-'.$year)
                ->setCellValue('O9', 'Nilai Buku 31-Des-'.$last_year);
        $this->phpexcel->getActiveSheet()
                ->mergeCells('A1:O1')
                ->mergeCells('A2:O2')
                ->mergeCells('A3:O3')
                ->mergeCells('A4:O4')
                ->mergeCells('A5:C5')
                ->mergeCells('A6:C6')
                ->mergeCells('D5:O5')
                ->mergeCells('D6:O6')
                ->mergeCells('A7:O7');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O7')->applyFromArray($styleTitleHeader);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O7')->applyFromArray($styleLeftAlignment);
//        $this->phpexcel->getActiveSheet()->getRowDimension(4)->setRowHeight(40.00);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A9:O9')->applyFromArray($styleDescColumn);
        // set width
        $this->phpexcel->getActiveSheet()->getColumnDimension('A')->setWidth(4.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('B')->setWidth(30.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('C')->setWidth(20.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('D')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('E')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('F')->setWidth(5.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('G')->setWidth(9.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('H')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('I')->setWidth(10.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('J')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('K')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('L')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('M')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('N')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('O')->setWidth(15.00);
        //set data gol 1
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B10', "Kendaraan Roda 4 (Gol 1)");
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A10:O10')->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A10:O10')->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B10')->applyFromArray($styleBold);
        $row = 11;
        $nom = 1;
        $hp_gol1 = 0;
        $aly_gol1 = 0;
        $pt_gol1 = 0;
        $ay_gol1 = 0;
        $nb_gol1 = 0;
        foreach ($rs_kendaraan_gol1 as $val) {
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('A' . $row, $nom++);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, $val['barang_nama']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('C' . $row, $val['barang_noinventaris']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('D' . $row, $this->datetimemanipulation->get_short_date_indo($val['barang_tglbeli']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('E' . $row, $this->datetimemanipulation->get_short_date_indo($val['tgl_berakhir']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('F' . $row, "1");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('G' . $row, $val['umur_manfaat']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H' . $row, $val['barang_harga_beli'])->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('I' . $row, $val['tarif']."%");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('J' . $row, $val['tarif_penyusutan'])->getStyle("J" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('K' . $row, $val['waktu']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L' . $row, $val['akm_last_year'])->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M' . $row, $val['penyusutan_thn'])->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N' . $row, ($val['akm_last_year'] - $val['penyusutan_thn']))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O' . $row, $val['barang_nilai_buku'])->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
            //hitung
            $hp_gol1 = $hp_gol1 + $val['barang_harga_beli'];
            $aly_gol1 = $aly_gol1 + $val['akm_last_year'];
            $pt_gol1 = $pt_gol1 + $val['penyusutan_thn'];
            $ay_gol1 = $ay_gol1 + ($val['akm_last_year'] - $val['penyusutan_thn']);
            $nb_gol1 = $nb_gol1 + $val['barang_nilai_buku'];
            //style
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleCenterAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleText);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleBorder);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
            $row++;
        }
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Kendaraan Roda 4 (Gol 1)");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, $hp_gol1)->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, $aly_gol1)->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, $pt_gol1)->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, $ay_gol1)->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, $nb_gol1)->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        $row++;
        //set data gol 2
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, "Kendaraan Roda 2 (Gol 2)");
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row.':O' . $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row.':O' . $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleBold);
        $row++;
        $nmr = 1;
        $hp_gol2 = 0;
        $aly_gol2 = 0;
        $pt_gol2 = 0;
        $ay_gol2 = 0;
        $nb_gol2 = 0;
        foreach ($rs_kendaraan_gol2 as $val) {
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('A' . $row, $nmr++);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, $val['barang_nama']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('C' . $row, $val['barang_noinventaris']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('D' . $row, $this->datetimemanipulation->get_short_date_indo($val['barang_tglbeli']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('E' . $row, $this->datetimemanipulation->get_short_date_indo($val['tgl_berakhir']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('F' . $row, "1");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('G' . $row, $val['umur_manfaat']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H' . $row, $val['barang_harga_beli'])->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('I' . $row, $val['tarif']."%");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('J' . $row, $val['tarif_penyusutan'])->getStyle("J" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('K' . $row, $val['waktu']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L' . $row, $val['akm_last_year'])->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M' . $row, $val['penyusutan_thn'])->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N' . $row, ($val['akm_last_year'] - $val['penyusutan_thn']))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O' . $row, $val['barang_nilai_buku'])->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
            //hitung
            $hp_gol2 = $hp_gol2 + $val['barang_harga_beli'];
            $aly_gol2 = $aly_gol2 + $val['akm_last_year'];
            $pt_gol2 = $pt_gol2 + $val['penyusutan_thn'];
            $ay_gol2 = $ay_gol2 + ($val['akm_last_year'] - $val['penyusutan_thn']);
            $nb_gol2 = $nb_gol2 + $val['barang_nilai_buku'];
            //style
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleCenterAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleText);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleBorder);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
            $row++;
        }
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Kendaraan Roda 2 (Gol 2)");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, $hp_gol2)->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, $aly_gol2)->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, $pt_gol2)->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, $ay_gol2)->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, $nb_gol2)->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        $row++;
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Aset Kendaraan");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, ($hp_gol1 + $hp_gol2))->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, ($aly_gol1 + $aly_gol2))->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, ($pt_gol1 + $pt_gol2))->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, ($ay_gol1 + $ay_gol2))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, ($nb_gol1 + $nb_gol2))->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        // setting
        $this->phpexcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
        $this->phpexcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
        $this->phpexcel->getActiveSheet()->setTitle('Kendaraan');
        $this->phpexcel->setActiveSheetIndex(0);
        //--
        $file_name = 'ASET_TETAP_KENDARAAN_'.date("d").'_'.date("m").'_'.date("Y");
        //--
//            header('Content-Type: application/vnd.ms-excel');
        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        header('Content-Disposition: attachment;filename=' . $file_name . '.xlsx');
        header('Cache-Control: max-age=0');
        // output
        $obj_writer = PHPExcel_IOFactory::createWriter($this->phpexcel, 'Excel2007');
        $obj_writer->save('php://output');
    }
    
    /*
     * BANGUNAN
     */
    
    // welcome administrator
    public function bangunan() {
        $this->_set_page_rule("R");

        // set template content
        $this->smarty->assign("template_content", "laporan/asettetap/bangunan/index.html");
        // get data
        $this->smarty->assign("rs_bangunan_gol1", $this->m_report_asset->get_bangunan(array(date("Y-m-d"),"20",$this->kat_bangunan)));
        $this->smarty->assign("rs_bangunan_gol2", $this->m_report_asset->get_bangunan(array(date("Y-m-d"),"10",$this->kat_bangunan)));
        $this->smarty->assign("year", date("Y"));
        $this->smarty->assign("last_year", date("Y", strtotime("-1 year")));
        // notification
        $this->tnotification->display_notification();
        $this->tnotification->display_last_field();

        // output
        parent::display();
    } 
    
    public function print_bangunan(){
        // set page rules
        $this->_set_page_rule("R");
        // style title header
        $styleTitleHeader = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => 'bold',
                'size' => 11
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER
            )
        );

        // style text
        $styleText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 10
            )
        );
        
        $styleMediumText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 11
            )
        );
        
        $styleBigText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 14
            )
        );

        // style desc title column
        $styleDescColumn = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => true,
                'size' => 10
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                ),
            )
        );

        // style content
        $styleContent = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => false,
                'size' => 10
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style border
        $styleBorder = array(
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style bold
        $styleBold = array(
            'font' => array(
                'bold' => true
            )
        );

        // style right alignment
        $styleRightAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style left alignment
        $styleLeftAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleLeftAlignment2 = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_TOP
            ),
        );

        // style justify alignment
        $styleJustifyAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style center alignment
        $styleCenterAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleBorderBottom = array(
            'borders' => array(
                'bottom' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );
        
        $styleBorderRight = array(
            'borders' => array(
                'right' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // data
        $rs_bangunan_gol1 = $this->m_report_asset->get_bangunan(array(date("Y-m-d"),"20",$this->kat_bangunan));
        $rs_bangunan_gol2 = $this->m_report_asset->get_bangunan(array(date("Y-m-d"),"10",$this->kat_bangunan));
        $year = date("Y");
        $last_year = date("Y", strtotime("-1 year"));
        
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('C')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('D')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('E')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('F')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('G')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('I')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('K')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('M')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('N')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('O')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)
                ->setCellValue('A1', "STMIK AMIKOM YOGYAKARTA")
                ->setCellValue('A2', "ASET TETAP DAN AKUMULASI PENYUSUTAN")
                ->setCellValue('A3', "BANGUNAN")
                ->setCellValue('A4', "Metode penyusutan : Garis lurus")
                ->setCellValue('A5', "Bangunan Permanen (Gol 1)")
                ->setCellValue('A6', "Bangunan Non Permanen (Gol 2)")
                ->setCellValue('D5', "20 Tahun")
                ->setCellValue('D6', "10 Tahun")
                ->setCellValue('A7', "Yang termasuk harga perolehan bangunan adalah nilai pembelian/pembuatan bangunan ditambah pajak-pajak, pengurusan akta jual beli dan sertifikat dan biaya yang muncul akibat pembelian tersebut.")
                ->setCellValue('A9', 'No')
                ->setCellValue('B9', 'Keterangan')
                ->setCellValue('C9', 'No Inventaris')
                ->setCellValue('D9', 'Tanggal Perolehan')
                ->setCellValue('E9', 'Tanggal Berakhir')
                ->setCellValue('F9', 'Gol')
                ->setCellValue('G9', 'Umur Manfaat (bulan)')
                ->setCellValue('H9', 'Harga Perolehan Baru')
                ->setCellValue('I9', 'Tarif (%)')
                ->setCellValue('J9', 'Tarif penyusutan per bulan')
                ->setCellValue('K9', 'Waktu penggunaan (bulan)')
                ->setCellValue('L9', 'Akm. Peny. 31-Des-'.$last_year)
                ->setCellValue('M9', 'Penyusutan Thn '.$year)
                ->setCellValue('N9', 'Akm. Peny. 31-Des-'.$year)
                ->setCellValue('O9', 'Nilai Buku 31-Des-'.$last_year);
        $this->phpexcel->getActiveSheet()
                ->mergeCells('A1:O1')
                ->mergeCells('A2:O2')
                ->mergeCells('A3:O3')
                ->mergeCells('A4:O4')
                ->mergeCells('A5:C5')
                ->mergeCells('A6:C6')
                ->mergeCells('D5:O5')
                ->mergeCells('D6:O6')
                ->mergeCells('A7:O7');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O7')->applyFromArray($styleTitleHeader);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O7')->applyFromArray($styleLeftAlignment);
//        $this->phpexcel->getActiveSheet()->getRowDimension(4)->setRowHeight(40.00);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A9:O9')->applyFromArray($styleDescColumn);
        // set width
        $this->phpexcel->getActiveSheet()->getColumnDimension('A')->setWidth(4.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('B')->setWidth(30.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('C')->setWidth(20.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('D')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('E')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('F')->setWidth(5.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('G')->setWidth(9.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('H')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('I')->setWidth(10.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('J')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('K')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('L')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('M')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('N')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('O')->setWidth(15.00);
        //set data gol 1
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B10', "Bangunan Permanen (Gol 1)");
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A10:O10')->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A10:O10')->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B10')->applyFromArray($styleBold);
        $row = 11;
        $nom = 1;
        $hp_gol1 = 0;
        $aly_gol1 = 0;
        $pt_gol1 = 0;
        $ay_gol1 = 0;
        $nb_gol1 = 0;
        foreach ($rs_bangunan_gol1 as $val) {
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('A' . $row, $nom++);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, $val['barang_nama']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('C' . $row, $val['barang_noinventaris']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('D' . $row, $this->datetimemanipulation->get_short_date_indo($val['barang_tglbeli']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('E' . $row, $this->datetimemanipulation->get_short_date_indo($val['tgl_berakhir']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('F' . $row, "1");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('G' . $row, $val['umur_manfaat']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H' . $row, $val['barang_harga_beli'])->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('I' . $row, $val['tarif']."%");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('J' . $row, $val['tarif_penyusutan'])->getStyle("J" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('K' . $row, $val['waktu']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L' . $row, $val['akm_last_year'])->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M' . $row, $val['penyusutan_thn'])->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N' . $row, ($val['akm_last_year'] - $val['penyusutan_thn']))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O' . $row, $val['barang_nilai_buku'])->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
            //hitung
            $hp_gol1 = $hp_gol1 + $val['barang_harga_beli'];
            $aly_gol1 = $aly_gol1 + $val['akm_last_year'];
            $pt_gol1 = $pt_gol1 + $val['penyusutan_thn'];
            $ay_gol1 = $ay_gol1 + ($val['akm_last_year'] - $val['penyusutan_thn']);
            $nb_gol1 = $nb_gol1 + $val['barang_nilai_buku'];
            //style
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleCenterAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleText);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleBorder);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
            $row++;
        }
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Bangunan Permanen (Gol 1)");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, $hp_gol1)->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, $aly_gol1)->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, $pt_gol1)->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, $ay_gol1)->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, $nb_gol1)->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        $row++;
        //set data gol 2
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, "Bangunan Non Permanen (Gol 2)");
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row.':O' . $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row.':O' . $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleBold);
        $row++;
        $nmr = 1;
        $hp_gol2 = 0;
        $aly_gol2 = 0;
        $pt_gol2 = 0;
        $ay_gol2 = 0;
        $nb_gol2 = 0;
        foreach ($rs_bangunan_gol2 as $val) {
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('A' . $row, $nmr++);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, $val['barang_nama']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('C' . $row, $val['barang_noinventaris']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('D' . $row, $this->datetimemanipulation->get_short_date_indo($val['barang_tglbeli']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('E' . $row, $this->datetimemanipulation->get_short_date_indo($val['tgl_berakhir']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('F' . $row, "1");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('G' . $row, $val['umur_manfaat']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H' . $row, $val['barang_harga_beli'])->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('I' . $row, $val['tarif']."%");
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('J' . $row, $val['tarif_penyusutan'])->getStyle("J" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('K' . $row, $val['waktu']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L' . $row, $val['akm_last_year'])->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M' . $row, $val['penyusutan_thn'])->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N' . $row, ($val['akm_last_year'] - $val['penyusutan_thn']))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O' . $row, $val['barang_nilai_buku'])->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
            //hitung
            $hp_gol2 = $hp_gol2 + $val['barang_harga_beli'];
            $aly_gol2 = $aly_gol2 + $val['akm_last_year'];
            $pt_gol2 = $pt_gol2 + $val['penyusutan_thn'];
            $ay_gol2 = $ay_gol2 + ($val['akm_last_year'] - $val['penyusutan_thn']);
            $nb_gol2 = $nb_gol2 + $val['barang_nilai_buku'];
            //style
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleCenterAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleText);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleBorder);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
            $row++;
        }
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Bangunan Non Permanen (Gol 2)");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, $hp_gol2)->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, $aly_gol2)->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, $pt_gol2)->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, $ay_gol2)->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, $nb_gol2)->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        $row++;
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Aset Bangunan");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, ($hp_gol1 + $hp_gol2))->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('L'. $row, ($aly_gol1 + $aly_gol2))->getStyle("L" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('M'. $row, ($pt_gol1 + $pt_gol2))->getStyle("M" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('N'. $row, ($ay_gol1 + $ay_gol2))->getStyle("N" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('O'. $row, ($nb_gol1 + $nb_gol2))->getStyle("O" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        // setting
        $this->phpexcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
        $this->phpexcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
        $this->phpexcel->getActiveSheet()->setTitle('Bangunan');
        $this->phpexcel->setActiveSheetIndex(0);
        //--
        $file_name = 'ASET_TETAP_BANGUNAN_'.date("d").'_'.date("m").'_'.date("Y");
        //--
//            header('Content-Type: application/vnd.ms-excel');
        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        header('Content-Disposition: attachment;filename=' . $file_name . '.xlsx');
        header('Cache-Control: max-age=0');
        // output
        $obj_writer = PHPExcel_IOFactory::createWriter($this->phpexcel, 'Excel2007');
        $obj_writer->save('php://output');
    }
    
    /*
     * TANAH
     */
    
    // welcome administrator
    public function tanah() {
        $this->_set_page_rule("R");

        // set template content
        $this->smarty->assign("template_content", "laporan/asettetap/tanah/index.html");
        // get data
        $this->smarty->assign("rs_tanah", $this->m_report_asset->get_tanah(array($this->kat_tanah)));
        $this->smarty->assign("year", date("Y"));
        $this->smarty->assign("last_year", date("Y", strtotime("-1 year")));
        // notification
        $this->tnotification->display_notification();
        $this->tnotification->display_last_field();

        // output
        parent::display();
    } 
    
    public function print_tanah(){
        // set page rules
        $this->_set_page_rule("R");
        // style title header
        $styleTitleHeader = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => 'bold',
                'size' => 11
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER
            )
        );

        // style text
        $styleText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 10
            )
        );
        
        $styleMediumText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 11
            )
        );
        
        $styleBigText = array(
            'font' => array(
                'name' => 'Times New Roman',
                'size' => 14
            )
        );

        // style desc title column
        $styleDescColumn = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => true,
                'size' => 10
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                ),
            )
        );

        // style content
        $styleContent = array(
            'font' => array(
                'name' => 'Times New Roman',
                'bold' => false,
                'size' => 10
            ),
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style border
        $styleBorder = array(
            'borders' => array(
                'allborders' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // style bold
        $styleBold = array(
            'font' => array(
                'bold' => true
            )
        );

        // style right alignment
        $styleRightAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style left alignment
        $styleLeftAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleLeftAlignment2 = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_TOP
            ),
        );

        // style justify alignment
        $styleJustifyAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );

        // style center alignment
        $styleCenterAlignment = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
                'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER
            ),
        );
        
        $styleBorderBottom = array(
            'borders' => array(
                'bottom' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );
        
        $styleBorderRight = array(
            'borders' => array(
                'right' => array(
                    'style' => PHPExcel_Style_Border::BORDER_THIN,
                    'color' => array('argb' => '000000'),
                )
            )
        );

        // data
        $rs_tanah = $this->m_report_asset->get_tanah(array($this->kat_tanah));
        $year = date("Y");
        $last_year = date("Y", strtotime("-1 year"));
        
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('C')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('D')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('E')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('F')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('G')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('I')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('K')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('M')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('N')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('O')->getAlignment()->setWrapText(true);
        $this->phpexcel->setActiveSheetIndex(0)
                ->setCellValue('A1', "STMIK AMIKOM YOGYAKARTA")
                ->setCellValue('A2', "ASET TETAP DAN AKUMULASI PENYUSUTAN")
                ->setCellValue('A3', "TANAH")
                ->setCellValue('A5', 'No')
                ->setCellValue('B5', 'Keterangan')
                ->setCellValue('C5', 'No Inventaris')
                ->setCellValue('D5', 'Tanggal Perolehan')
                ->setCellValue('E5', 'Tanggal Berakhir')
                ->setCellValue('F5', 'Gol')
                ->setCellValue('G5', 'Umur Manfaat (bulan)')
                ->setCellValue('H5', 'Harga Perolehan Baru')
                ->setCellValue('I5', 'Tarif (%)')
                ->setCellValue('J5', 'Tarif penyusutan per bulan')
                ->setCellValue('K5', 'Waktu penggunaan (bulan)')
                ->setCellValue('L5', 'Akm. Peny. 31-Des-'.$last_year)
                ->setCellValue('M5', 'Penyusutan Thn '.$year)
                ->setCellValue('N5', 'Akm. Peny. 31-Des-'.$year)
                ->setCellValue('O5', 'Nilai Buku 31-Des-'.$last_year);
        $this->phpexcel->getActiveSheet()
                ->mergeCells('A1:O1')
                ->mergeCells('A2:O2')
                ->mergeCells('A3:O3');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O3')->applyFromArray($styleTitleHeader);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A1:O3')->applyFromArray($styleLeftAlignment);
//        $this->phpexcel->getActiveSheet()->getRowDimension(4)->setRowHeight(40.00);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A5:O5')->applyFromArray($styleDescColumn);
        // set width
        $this->phpexcel->getActiveSheet()->getColumnDimension('A')->setWidth(4.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('B')->setWidth(30.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('C')->setWidth(20.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('D')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('E')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('F')->setWidth(5.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('G')->setWidth(9.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('H')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('I')->setWidth(10.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('J')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('K')->setWidth(11.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('L')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('M')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('N')->setWidth(15.00);
        $this->phpexcel->getActiveSheet()->getColumnDimension('O')->setWidth(15.00);
        //set data gol 1
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B6', "Tanah");
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A6:O6')->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A6:O6')->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B6')->applyFromArray($styleBold);
        $row = 7;
        $nom = 1;
        $hp = 0;
        foreach ($rs_tanah as $val) {
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('A' . $row, $nom++);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B' . $row, $val['barang_nama']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('C' . $row, $val['barang_noinventaris']);
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('D' . $row, $this->datetimemanipulation->get_short_date_indo($val['barang_tglbeli']));
            $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H' . $row, $val['barang_harga_beli'])->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
            //hitung
            $hp = $hp + $val['barang_harga_beli'];
            //style
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleCenterAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleText);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('A' . $row . ':O' . $row)->applyFromArray($styleBorder);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
            $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
            $row++;
        }
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('B'. $row, "Jumlah Aset Tanah");
        $this->phpexcel->setActiveSheetIndex(0)->setCellValue('H'. $row, $hp)->getStyle("H" . $row)->getNumberFormat()->setFormatCode('#,##0');
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleText);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBorder);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('A'. $row.':O'. $row)->applyFromArray($styleBold);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('B' . $row)->applyFromArray($styleLeftAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('H' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('J' . $row)->applyFromArray($styleRightAlignment);
        $this->phpexcel->setActiveSheetIndex(0)->getStyle('L' . $row . ':O' . $row)->applyFromArray($styleRightAlignment);
        
        // setting
        $this->phpexcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
        $this->phpexcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
        $this->phpexcel->getActiveSheet()->setTitle('Tanah');
        $this->phpexcel->setActiveSheetIndex(0);
        //--
        $file_name = 'ASET_TETAP_TANAH_'.date("d").'_'.date("m").'_'.date("Y");
        //--
//            header('Content-Type: application/vnd.ms-excel');
        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        header('Content-Disposition: attachment;filename=' . $file_name . '.xlsx');
        header('Cache-Control: max-age=0');
        // output
        $obj_writer = PHPExcel_IOFactory::createWriter($this->phpexcel, 'Excel2007');
        $obj_writer->save('php://output');
    }
    
    /*
     * CHART
     */
    
    public function data_xml_aset() {
        // data
        $rs_mebel = $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_mebel,"","baik"));
        $rs_perlengkapan = $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_elektronik,$this->kat_multimedia,"baik"));
        $rs_kendaraan = $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_kendaraan,"","baik"));
        $rs_bangunan = $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_bangunan,"","baik"));
        $rs_mesin = $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_mesin,"","baik"));
        $rs_tanah = $this->m_report_asset->get_total_harga_beli_nilai_buku(array($this->kat_tanah,"",""));
        $max = $this->_get_value_grafik($rs_mebel['total_harga_beli']) + $this->_get_value_grafik($rs_perlengkapan['total_harga_beli']) 
                + $this->_get_value_grafik($rs_kendaraan['total_harga_beli']) + $this->_get_value_grafik($rs_bangunan['total_harga_beli']) 
                + $this->_get_value_grafik($rs_mesin['total_harga_beli']) + $this->_get_value_grafik($rs_tanah['total_harga_beli']);
        $max_html = 'yAxisMaxValue="'.($max + 1).'"';
        
        // data
        
        
        header("Content-type: text/xml");

        $data = '';
        $data .= '<chart 
                ' . $max_html . '
                showValues="1" 
                yAxisMinValue="0"
                yAxisName="Rupiah"
                numberSuffix=" Juta"
                formatNumberScale="0" 
                rotateValues="1"
                bgColor="FFFFFF"
                showBorder="0"
                decimalSeparator=","
                thousandSeparator="."
                decimalPrecision="2" 
                numvdivlines="6" 
                limitsDecimalPrecision="2">';
        $data .= '<categories>
                    <category label="Mebel dan Furnitur " />
                    <category label="Perlengkapan Kantor dan Perkuliahan" />
                    <category label="Kendaraan" />
                    <category label="Bangunan" />
                    <category label="Tanah" />
                    <category label="Mesin dan Tower" />
                  </categories>';
        $data .= '<dataset seriesname="Harga beli" color="AFD8F8" showvalues="0">
                    <set value="'.(!empty($rs_mebel['total_harga_beli'])?$this->_get_value_grafik($rs_mebel['total_harga_beli']):0).'" />
                    <set value="'.(!empty($rs_perlengkapan['total_harga_beli'])?$this->_get_value_grafik($rs_perlengkapan['total_harga_beli']):0).'" />
                    <set value="'.(!empty($rs_kendaraan['total_harga_beli'])?$this->_get_value_grafik($rs_kendaraan['total_harga_beli']):0).'" />
                    <set value="'.(!empty($rs_bangunan['total_harga_beli'])?$this->_get_value_grafik($rs_bangunan['total_harga_beli']):0).'" />
                    <set value="'.(!empty($rs_tanah['total_harga_beli'])?$this->_get_value_grafik($rs_tanah['total_harga_beli']):0).'" />
                    <set value="'.(!empty($rs_mesin['total_harga_beli'])?$this->_get_value_grafik($rs_mesin['total_harga_beli']):0).'" />
                  </dataset>';
        $data .= '<dataset seriesname="Nilai buku" color="F6BD0F" showvalues="0">
                    <set value="'.(!empty($rs_mebel['total_nilai_buku'])?$this->_get_value_grafik($rs_mebel['total_nilai_buku']):0).'" />
                    <set value="'.(!empty($rs_perlengkapan['total_nilai_buku'])?$this->_get_value_grafik($rs_perlengkapan['total_nilai_buku']):0).'" />
                    <set value="'.(!empty($rs_kendaraan['total_nilai_buku'])?$this->_get_value_grafik($rs_kendaraan['total_nilai_buku']):0).'" />
                    <set value="'.(!empty($rs_bangunan['total_nilai_buku'])?$this->_get_value_grafik($rs_bangunan['total_nilai_buku']):0).'" />
                    <set value="'.(!empty($rs_tanah['total_nilai_buku'])?$this->_get_value_grafik($rs_tanah['total_nilai_buku']):0).'" />
                    <set value="'.(!empty($rs_mesin['total_nilai_buku'])?$this->_get_value_grafik($rs_mesin['total_nilai_buku']):0).'" />
                  </dataset>';
        $data .= "</chart>";
        echo $data;
    }
    
    private function _get_value_grafik($price){
        $value=0;
        if (!empty($price)) {
            $value = round(($price/1000000), 2);
        } 
        
        return $value;
    }
    
}
